#ifndef __VERSION_H__
#define __VERSION_H__

#include <stddef.h>
#include <stdbool.h>
#include <stdint.h>
/** @addtogroup MOTOR_CTRL_MODULE
 * @{
 */
/** @defgroup AUTO_VERSION_MODULE 版本自动生成
 * @{
 */
typedef enum {
    VerStandard = 0,
    VerBeta
}vertype_t;
typedef union
{
    struct
    {
        uint32_t sec : 6; /*!< second*/
        uint32_t min : 6; /*!< minute*/
        uint32_t hr : 5;  /*!< hour*/
        uint32_t dd : 5;  /*!< day*/
        uint32_t mm : 4;  /*!< month*/
        uint32_t yy : 6;  /*!< year*/
    } bits;
    uint32_t dword; /*!< date & time code*/
} date_time_t;

#define VER_GENERATE(s, y, m, d) ((uint16_t)((((s)&0x1) << 15) | (((y)&0x3F) << 9) | (((m)&0xF) << 5) | (((d)&0x1F) << 0)))
#define VER_GET(x) (((x)&0x7E00) >> 9), (((x)&0x1E0) >> 5), (((x)&0x1F) >> 0)
extern uint16_t get_version(vertype_t vt);
extern uint16_t get_date_code(void);
extern uint16_t get_time_code(void);
extern uint32_t get_date_time_code(void);
extern uint16_t set_version(uint8_t s, uint16_t y, uint8_t m, uint8_t d);
/**
 * @}
 */
/**
 * @}
 */
#endif
